/**
 * 
 */
package com.util;

import java.io.IOException;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Properties;

/**
 * @author Ltz
 */
public class StringUitl {
	/**
	 * 获取系统时间
	 * 
	 * @return
	 */
	public static String GetNowDate() {
		String temp_str = "";
		Date dt = new Date();
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd aaHH:mm:ss ");
		temp_str = sdf.format(dt);
		return temp_str;
	}

	/**
	 * 获取类名
	 * 
	 * @param tableName
	 * @return
	 */
	public static String GetClassName(String tableName) {
		String[] strarray = tableName.split("_");
		for (int i = 0; i < strarray.length; i++) {
			strarray[i] = strarray[i].replaceFirst(strarray[i].substring(0, 1), strarray[i].substring(0, 1).toUpperCase());
		}
		StringBuffer rs = new StringBuffer();
		for (int i = 0; i < strarray.length; i++) {
			rs.append(strarray[i]);
		}
		return rs.toString();
	}

    /**
     * 首字母大写
     * @param name
     * @return
     */
    public static String CaptureName(String name) {
        char[] cs=name.toCharArray();
        cs[0]-=32;
        return String.valueOf(cs);

    }

    /**
     * 根据key从配置文件读取参数值
     * @return
     */
    public static String GetConfigFileParam(String key) {
        Properties prop = new Properties();
        InputStream in = Object.class.getResourceAsStream("/config.properties");
        String rs = null;
        try {
            prop.load(in);
            rs = prop.getProperty(key).trim();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return rs;
    }

}
